#Developed By Dylan Pavelko
import os

from fixture import *

SRFresnel = DMXFixture("SR Fresnel", fresnel, "13")
SLElipsoidal = DMXFixture("SL Fresnel", ellipsoidal, "14")

testShowGrid = ShowGrid("My First Test Show Grid")
testShow.addFixtureToShow(SRFresnel)
testShow.addFixtureToShow(SLElipsoidal)


SRFresnel.setColorLabel("red")
SLElipsoidal.setColorLabel("blue")


os.system("clear")

input = ""
while(input is not "0"):
	print "Select Number to Perform Operation"
	print " 1. Add Fixture"
	print " 2. View List of Fixtures"
	print " 3. Set Value for Fixture"
	print " 4. View Value for Fixture"
	print " 0. Exit Dyl-Lighting"	
	input = raw_input(">")
	
	if(input is "1"):
		print "Select Fixture Type to Add:"
		print " future will have a generated list"
		print " todo: add new fixture type"
		print " 0. Cancel"
		fixtureTypeInput = raw_input(">")
		
		if(fixtureTypeInput is not "0"):
			print "Enter " + "FIXTURE_TYPE" + " NAME:"
			name = raw_input(">")
			print "Enter " + "FIXTURE_TYEPE" + " DMX Start Address:"
			dmxStart = raw_input(">")
			
			#note that the fact its adding a fresnel is only temporary for development purposes
			testShow.addFixtureToShow(DMXFixture(name, copy.deepcopy(fresnel), dmxStart))
			print "Ooops this feature isn't done yet! :P ... need to be able to specify fixture type"
	
	if(input is "2"):
		i = 0
		while (len(testShow.myFixtures) > i):
			print " " + testShow.myFixtures[i].name
			i += 1
			
		print "Press Enter to Return to Main Menu"
		raw_input(">")
	
	if(input is "3"):
		print "Choose fixture by:"
		print " 1. DMX Start Address"
		print " 2. Fixture Name"
		print " 0. Cancel"
		searchByInput = raw_input(">")
		
		if(searchByInput is not "0"):
			if(searchByInput is "1"):
				print "Enter Fixtures DMX Start Address"
				tempInput = raw_input(">")
				tempFixture = testShow.getDMXFixtureByStartAddress(tempInput)
			elif(searchByInput is "2"):
				print "Enter Fixtures Name"
				tempInput = raw_input(">")
				tempFixture = testShow.getFixtureByName(tempInput)
			
			##EVENTUALLY make this be select property to set
			print "Enter fixture Intensity"
			tempInput = raw_input(">")
			tempFixture.getProperty("Intensity").setValue(tempInput)
			
	if(input is "4"):
		print "Choose fixture by:"
		print " 1. DMX Start Address"
		print " 2. Fixture Name"
		print " 0. Cancel"
		searchByInput = raw_input(">")
		
		if(searchByInput is not "0"):
			if(searchByInput is "1"):
				print "Enter Fixtures DMX Start Address"
				tempInput = raw_input(">")
				fixture = testShow.getDMXFixtureByStartAddress(tempInput)
			elif(searchByInput is "2"):
				print "Enter Fixtures Name"
				tempInput = raw_input(">")
				fixture = testShow.getFixtureByName(tempInput)
			
			##EVENTUALLY make this be select property to view
			print "Fixture Intensity is " + str(fixture.getProperty("Intensity").getValue())
			